//=======================================================================
//		Copyright (c) 2011-2012 by MicroStrategy, Inc.  This copyrighted material
//		is the confidential, unpublished property of MicroStrategy.  This
//		copyright notice and any other copyright notices included in machine
//		readable copies must be reproduced on all authorized copies.
//
//		File:	FPCodeStrs.js
//
//		Date:	Monday, May 16, 2011
//
//		Desc:	Code strings used by FunctionObject routines.
//=======================================================================

//--------------------------------------------------
// replacement codes
//--------------------------------------------------
//  %fi     function index
//  %pi     parameter or property index
//  %pn     parameter or property name
//  %pt     parameter type (aParamTypes or aPropTypes)
//  %pd     property description
//  %amp    ampersand
//  %dss    DSS data type (aDataDssTypes)
//  %dsp    display type (aDataDispTypes)
//  %cty    C data type (aDataCTypes)
//  %pvt    property variant type (aPropVTs)
//  %pva    property value(aPropVals)
//  %pdf    property default value
//  %asr    allocate storage for repeat input
//  %ci     column index
//  %brk    break
//  %inc    input count
//  %rcv    repeat count value
//  %rcn    repeat case index
//  %rii    repeat init index
//  %riv    repeat init value
//  %nrc    non-repeat count (inCnt - repCnt)
//  %rc1    repeat count range (..nParam-1)
//  %rc2    repeat count range ([0..nParam-n])
//  %rci    repeat count increment
//  %vi     vector input flag
//  %sl     string length
//  %ssc    scalar size check

var FP_NL = "\r\n";
var FP_PROPVAR = "\t%pt\tm%fi_%pn;\r\n";
var FP_PROPVAR_RSCRIPT = "\tchar *\tm%fi_%pn;\r\n";
var FP_PROPVAR_INIT_BSTR = "\tm%fi_%pn = NULL;\r\n";

var FP_CS_LEN = "MAXSIZE_CHAR_STR";
var FP_DS_LEN = "MAXSIZE_DATE_STR";

//--------------------------------------------------
// code strings used by all function plug-in types
//--------------------------------------------------
var FP_SWITCH_STMT_START =
    "\t\t\t\tswitch (nParamIndex)\r\n" +
    "\t\t\t\t{\r\n";
    
var FP_SWITCH_STMT_START_REP =
    "\t\t\t\tswitch (lPIndex)\r\n" +
    "\t\t\t\t{\r\n";
    
var FP_SWITCH_CASE =
	"\t\t\t\tcase %pi:  ";
    
var FP_PARAM_SWITCH_CASE =
	"\t\t\t\tcase %pi:  // m%fi_%pn\r\n";

var FP_SWITCH_DEFAULT =
    "\t\t\t\tdefault:  ";

var FP_SWITCH_NOCASE =
    "\t\t\t\t\t";

var FP_SWITCH_BREAK =
	"\t\t\t\t\t\tbreak;\r\n";

var FP_SWITCH_STD_DEFAULT =
    "\t\t\t\tdefault:\r\n" +
    "\t\t\t\t\t{\r\n" +
    "\t\t\t\t\t\treturn E_FAIL;  // invalid parameter index\r\n" +
    "\t\t\t\t\t}\r\n";

var FP_SWITCH_STMT_END =
    "\t\t\t\t}\r\n";
		
// used in get_PropertyInfo()
var FP_GETPROP_CASE =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\tbstrName = L\"%pn\";\r\n" +
	"\t\t\t\t\tbstrDesc = L\"%pd\";\r\n" +
	"\t\t\t\t\t(*pValue).vt = %pvt;\r\n" +
	"\t\t\t\t\t(*pValue).%pva = %pdf;\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}\r\n";
var FP_GETPROPBSTR_CASE =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\tbstrName = L\"%pn\";\r\n" +
	"\t\t\t\t\tbstrDesc = L\"%pd\";\r\n" +
	"\t\t\t\t\t(*pValue).vt = %pvt;\r\n" +
	"\t\t\t\t\t(*pValue).%pva = SysAllocString(OLESTR(\"%pdf\"));\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}\r\n";
var FP_GETPROPDATE_CASE =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\tbstrName = L\"%pn\";\r\n" +
	"\t\t\t\t\tbstrDesc = L\"%pd\";\r\n" +
	"\t\t\t\t\t(*pValue).vt = %pvt;\r\n" +
	"\t\t\t\t\tCComVariant cmvDate = L\"%pdf\";\r\n" +
	"\t\t\t\t\tcmvDate.ChangeType(VT_DATE);\r\n" +
	"\t\t\t\t\t(*pValue).date = cmvDate.date;\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}\r\n";

var FP_DESTRUCT_BSTR =
	"\t\tSysFreeString(m%fi_%pn);\r\n";

var FP_DESTRUCT_STR =
	"\t\tif(m%fi_%pn) delete [] m%fi_%pn;\r\n";

// used in SetProperty()
var FP_SETPROP_CASE =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\thr = VariantChangeType(pValue, pValue, 0, %pvt);\r\n" +
	"\t\t\t\t\tif ( FAILED(hr) ) return hr;\r\n\r\n" +
	"\t\t\t\t\tif(pValue->vt == %pvt)\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\tm%fi_%pn = pValue->%pva;\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\telse\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\treturn E_FAIL;\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}";
var FP_SETPROPBSTR_CASE =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\thr = VariantChangeType(pValue, pValue, 0, %pvt);\r\n" +
	"\t\t\t\t\tif ( FAILED(hr) ) return hr;\r\n\r\n" +
	"\t\t\t\t\tif(pValue->vt == %pvt)\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\tSysFreeString(m%fi_%pn);\r\n" +
	"\t\t\t\t\t\tm%fi_%pn = SysAllocString(pValue->%pva);\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\telse\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\treturn E_FAIL;\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}";
var FP_SETPROP_CASE_R =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\thr = VariantChangeType(pValue, pValue, 0, %pvt);\r\n" +
	"\t\t\t\t\tif ( FAILED(hr) ) return hr;\r\n\r\n" +
	"\t\t\t\t\tif(pValue->vt == %pvt)\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\thr = m_pRSupp->SetRVarV(\"%pn\", pValue, NULL);\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\telse\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\treturn E_FAIL;\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}";
var FP_SETPROP_CASE_RSCRIPT =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\thr = VariantChangeType(pValue, pValue, 0, %pvt);\r\n" +
	"\t\t\t\t\tif ( FAILED(hr) ) return hr;\r\n\r\n" +
	"\t\t\t\t\tif(pValue->vt == %pvt)\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\tif(m%fi_%pn) delete [] m%fi_%pn;\r\n" +
	"\t\t\t\t\t\tInt_32 lSrcLen = SysStringLen(pValue->bstrVal);\r\n" +
	"\t\t\t\t\t\tm%fi_%pn = new char [lSrcLen + 1];\r\n" +
	"\t\t\t\t\t\tif(!m%fi_%pn) return E_OUTOFMEMORY;\r\n" +
	"\t\t\t\t\t\tsize_t returnLen;\r\n" +
	"\t\t\t\t\t\twcstombs_s(&returnLen, m%fi_%pn, lSrcLen+1, pValue->bstrVal, lSrcLen);\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\telse\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\treturn E_FAIL;\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}";
var FP_SETPROPBOOL_CASE =
	"\t\t\tcase %pi:  // %pn\r\n" +
	"\t\t\t\t{\r\n" +
	"\t\t\t\t\thr = VariantChangeType(pValue, pValue, 0, %pvt);\r\n" +
	"\t\t\t\t\tif ( FAILED(hr) ) return hr;\r\n\r\n" +
	"\t\t\t\t\tif(pValue->vt == %pvt)\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\tm%fi_%pn = (pValue->%pva==VARIANT_TRUE);\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\telse\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\treturn E_FAIL;\r\n" +
	"\t\t\t\t\t}\r\n" +
	"\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t}";

var FP_GETPARAMINFO_CASE =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\tbstrName=L\"%pn\";\r\n" +
	"\t\t\t\t\t\t*pType=DssParameter%pt;\r\n" +
	"\t\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t\t}\r\n";

//--------------------------------------------------
// code strings used by NNSimple routines
//--------------------------------------------------
var FP_INPARAMDECLS =
	"\t%cty %pn;\r\n";

var FP_INPARAMDECLS_REP =
	"\t%cty *%pn = NULL;\r\n";

var FP_GETPARAMFROMVARIANT =
	"\t\thr = getParamFromVariant(pParam, %pi, %dss, (BYTE *)%amp%pn);\r\n" +
	"\t\tif (hr != S_OK) return hr;\r\n";

var FP_GPFV_REP_FOR_START =
    "\t\tfor(i=INCNT-REPCNT,j=0;i<nParam;i++)\r\n" +
    "\t\t{\r\n" +
    "\t\t\tswitch((i-(INCNT-REPCNT)) % REPCNT)\r\n" +
    "\t\t\t{\r\n";

var FP_GPFV_REP_CASE =
    "\t\t\tcase %rcn:\r\n" +
	"\t\t\t\thr = getParamFromVariant(pParam, i, %dss, (BYTE *)%amp%pn[j]);\r\n%rci" +
	"\t\t\t\tbreak;\r\n";

var FP_GPFV_REP_FOR_END =
    "\t\t\t}\r\n" +
	"\t\t\tif (hr != S_OK) throw hr;\r\n" +
	"\t\t}\r\n";

var FP_ALLOCLOCALMEM_REP =
    "\t\t%pn = new %cty [lRepCnt];\r\n" +
    "\t\tif(!%pn) throw E_OUTOFMEMORY;\r\n";
    
var FP_FREELOCALMEM_REP =
    "\tif(%pn) delete [] %pn;\r\n";

//--------------------------------------------------
// code strings used by Generic & NNGeneric routines
//--------------------------------------------------
var FP_NGEN_INPARAMDECL =
	"\t%cty %sm%fi_%pn;\r\n";

var FP_NGEN_INPARAMINIT_PTR =
	"\tm%fi_%pn = NULL;\r\n";

var FP_NGEN_INPARAMINIT_NUM =
	"\tm%fi_%pn = 0.0;\r\n";

var FP_NGEN_INPARAMINIT_STR =
    "\tstrcpy_s(m%fi_%pn, \"\\0\");";

var FP_NGEN_GETINPARAMTYPE_CASE =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\t*pType=DssParameter%pt;\r\n%rci" +
	"\t\t\t\t\t\tbreak;\r\n" +
	"\t\t\t\t\t}\r\n";

var FP_NGEN_GETINPARAMTYPE_NOCASE =
	"\t\t\t\t// m%fi_%pn\r\n" +
	"\t\t\t\t*pType=DssParameter%pt;\r\n" +
    "\t\t\t\tm_lRepeatCnt++;\r\n";

var FP_NGEN_GETINPARAMTYPE_REPCNT =
    "\t\t\t\t\t\tm_lRepeatCnt++;\r\n";

var FP_NGEN_SETINPARAM_ALLOC_REP =
	"\t\t\t\t\t\tif (m%fi_%pn == NULL)\r\n" +
	"\t\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\t\tm%fi_%pn = new %cty%s[m_lRepeatCnt];\r\n" +
	"\t\t\t\t\t\t\tif (m%fi_%pn == NULL)\r\n" +
	"\t\t\t\t\t\t\t\treturn E_OUTOFMEMORY;\r\n" +
	"\t\t\t\t\t\t\tfor(Int_32 i=0;i<m_lRepeatCnt;i++)\r\n" +
	"\t\t\t\t\t\t\t\tm%fi_%pn[i]%rii = %riv;\r\n" +
	"\t\t\t\t\t\t}\r\n";

var FP_NGEN_SETINPARAM_INDEX =
    "[lRepIndex]";

var FP_NGEN_SETINPARAM_INDEX_1_1 =
    "[nParamIndex - 1]";

var FP_NGEN_PARAMDESTRUCT_1DIM =
	"\t\tif(m%fi_%pn != NULL) delete [] m%fi_%pn;\r\n";

var FP_NGEN_PARAMDESTRUCT_2DIM =
    "\t\tif(m%fi_%pn != NULL)\r\n" +
    "\t\t{\r\n" +
    "\t\t\tfor(Int_32 i=0;i<m_lRepeatCnt;i++)\r\n" +
    "\t\t\t\tdelete [] m%fi_%pn[i];\r\n" +
    "\t\t\tdelete [] m%fi_%pn;\r\n" +
    "\t\t}\r\n";

var FP_NGEN_VECTOR_INPUT =
    "\t\t\t\t\t\tbVector = true;\r\n";

var FP_NGEN_CLEAR_1DIM =
    "\t\t\t\tif(m%fi_%pn != NULL)\r\n" +
    "\t\t\t\t{\r\n" +
    "\t\t\t\t\tdelete [] m%fi_%pn;\r\n" +
    "\t\t\t\t\tm%fi_%pn = NULL;\r\n" +
    "\t\t\t\t}\r\n";

var FP_NGEN_CLEAR_2DIM =
    "\t\t\t\tif(m%fi_%pn != NULL)\r\n" +
    "\t\t\t\t{\r\n" +
    "\t\t\t\t\tfor(Int_32 i=0;i<m_lRepeatCnt;i++)\r\n" +
    "\t\t\t\t\t\tdelete [] m%fi_%pn[i];\r\n" +
    "\t\t\t\t\tdelete [] m%fi_%pn;\r\n" +
    "\t\t\t\t\tm%fi_%pn = NULL;\r\n" +
    "\t\t\t\t}\r\n";

//--------------------------------------------------
// code strings used by Generic routines
//--------------------------------------------------
// used by SetInputParam()
var FP_GEN_SETINPARAM_SCALAR_CASE =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\tif (nSize != 1)\r\n" +
	"\t\t\t\t\t\t\treturn E_FAIL;\r\n%asr" +
	"\t\t\t\t\t\tif (*pFlag == DssDataOk)\r\n" +
	"\t\t\t\t\t\t\tm%fi_%pn%ci = *pData;\r\n" +
	"\t\t\t\t\t\telse\r\n" +
	"\t\t\t\t\t\t\tm%fi_%pn%ci = 0.0;\r\n%vi%brk" +
	"\t\t\t\t\t}\r\n";

var FP_GEN_SETINPARAM_VECTOR_CASE =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n%asr" +
	"\t\t\t\t\t\tm%fi_%pn%ci = new double[nSize];\r\n" +
	"\t\t\t\t\t\tif (m%fi_%pn%ci == NULL)\r\n" +
	"\t\t\t\t\t\t\treturn E_OUTOFMEMORY;\r\n\r\n" +
	"\t\t\t\t\t\tfor(Int_32 i=0;i<nSize;i++)\r\n" +
	"\t\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\t\tif (pFlag[i] == DssDataOk)\r\n" +
	"\t\t\t\t\t\t\t\tm%fi_%pn%ci[i] = pData[i];\r\n" +
	"\t\t\t\t\t\t\telse\r\n" +
	"\t\t\t\t\t\t\t\tm%fi_%pn%ci[i] = 0.0;\r\n" +
	"\t\t\t\t\t\t}\r\n%vi%brk" +
	"\t\t\t\t\t}\r\n";

//--------------------------------------------------
// code strings used by NNGeneric routines
//--------------------------------------------------
// used by SetInputParam()
var FP_NNGEN_SETINPARAM_SCALAR_CASE =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\tif (nSize != 1)\r\n" +
	"\t\t\t\t\t\t\treturn E_FAIL;\r\n%asr" +
	"\t\t\t\t\t\thr = ConvertFromVariant(pData, %dss, (BYTE *)%ampm%fi_%pn%ci);\r\n" +
	"\t\t\t\t\t\tif (hr != S_OK) return hr;\r\n%vi%brk" +
	"\t\t\t\t\t}\r\n";
var FP_NNGEN_SETINPARAM_VECTOR_CASE =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n%asr" +
	"\t\t\t\t\t\tm%fi_%pn%ci = new %cty[nSize];\r\n" +
	"\t\t\t\t\t\tif (m%fi_%pn%ci == NULL)\r\n" +
	"\t\t\t\t\t\t\treturn E_OUTOFMEMORY;\r\n\r\n" +
	"\t\t\t\t\t\tfor(Int_32 i=0;i<nSize;i++)\r\n" +
	"\t\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\t\thr = getParamFromVariant(pData, i, %dss, (BYTE *)%ampm%fi_%pn%ci[i]);\r\n" +
	"\t\t\t\t\t\t\tif (hr != S_OK) return hr;\r\n" +
	"\t\t\t\t\t\t}\r\n%vi%brk" +
	"\t\t\t\t\t}\r\n";

//--------------------------------------------------
// code strings used in PDS file
//--------------------------------------------------
// parameter type code string
var FP_PARAMTYPE_PDS =
	"\t<PARAMETERTYPE INDEX=\"%i\" NAME=\"%pn\" TYPE=\"%i\" INPARAMETER = \"%s\" />\r\n";

var FP_DATATYPE_PDS =
	"\t<DATATYPE INDEX = \"%i\" TYPE=\"%i\" INPARAMETER = \"%s\" />\r\n";

var FP_OBJTYPE_PDS =
	"\t<OBJECTTYPE INDEX = \"%i\" TYPE=\"%i\" INPARAMETER = \"%s\" />\r\n";

var FP_PROPERTY_PDS =
	"\t<FUNC_PROPERTY NAME=\"%s\" TYPE=\"%s\" DEFAULT=\"%s\" DESCRIPTION=\"%s\" />\r\n";

//--------------------------------------------------
// strings used to comment parameters and properties
//--------------------------------------------------
var FP_REPEAT_CMT = ", repeat";

var FP_INPARAM_COMMENT =
	"\r\n//\t\t\tpParam[%pi%rc1]:\t%pn%rc2, %pt, %dsp";

var FP_NGEN_INPARAM_COMMENT =
	"\r\n//\t\t\tm%fi_%pn%s:\t%pt, %dsp";

var FP_NGEN_INPARAM_COMMENT_R =
	"\r\n//\t\t\t%pn, %pt, %dsp";

var FP_SCALAR_OUTPARAM_COMMENT =
	"\r\n//\t\t\t*pResult:\t%pn, %pt, %dsp";

var FP_VECTOR_OUTPARAM_COMMENT =
	"\r\n//\t\t\tpResult[r]:\t%pn, %pt, %dsp";

var FP_PROP_COMMENT =
	"\r\n//\t\tm%fi_%pn(%pt):\t%pd";

//--------------------------------------------------
// R support
//--------------------------------------------------
var FP_NGEN_SETINPARAM_INDEX_R = "lRepIndex";
var FP_NGEN_SETINPARAM_INDEX_1_1_R = "nParamIndex - 1";
var FP_NGEN_SCALAR_SIZE_CHK =
	"\t\t\t\t\t\tif (nSize != 1)\r\n" +
	"\t\t\t\t\t\t\treturn E_FAIL;\r\n";
var FP_GEN_SETINPARAM_CASE_R =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n%ssc" +
    "\t\t\t\t\t\tm_pRSupp->SetRVar(\"%pn\", nSize, pData, pFlag);\r\n%vi%brk" +
    "\t\t\t\t\t}\r\n";
var FP_GEN_SETINPARAM_RP_CASE_R =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n%ssc" +
    "\t\t\t\t\t\tm_pRSupp->SetRVar_mx(\"%pn\", %ci, nSize, m_lRepeatCnt, pData, pFlag);\r\n%vi%brk" +
    "\t\t\t\t\t}\r\n";
var FP_NNGEN_SETINPARAM_SCALAR_CASE_R =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n%ssc" +
    "\t\t\t\t\t\thr = m_pRSupp->SetRVarV(\"%pn\", pData, pFlag);\r\n" +
    "\t\t\t\t\t\tCHECK_HR(L\"Setting of '%pn' failed.\");\r\n%vi%brk" +
    "\t\t\t\t\t}\r\n";
var FP_NNGEN_SETINPARAM_VECTOR_CASE_R =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n" +
    "\t\t\t\t\t\thr = m_pRSupp->SetRVarSA(\"%pn\", nSize, %dss, pData, pFlag);\r\n" +
    "\t\t\t\t\t\tCHECK_HR(L\"Setting of '%pn' failed.\");\r\n%vi%brk" +
    "\t\t\t\t\t}\r\n";
var FP_NNGEN_SETINPUTPARAM_RP_CASE_R =
	"// m%fi_%pn\r\n" +
	"\t\t\t\t\t{\r\n" +
	"\t\t\t\t\t\thr = m_pRSupp->SetRVarSA_mx(\"%pn\", %ci, nSize, m_lRepeatCnt, %dss, pData, pFlag);\r\n" +
    "\t\t\t\t\t\tCHECK_HR(L\"Setting of '%pn' failed.\");\r\n%vi%brk" +
    "\t\t\t\t\t}\r\n";

var FP_SIM_SETRVAR = "\t\tm_pRSupp->SetRVar(\"%pn\", 1, &pParam[%pi], NULL);\r\n";
var FP_SIM_SETRVAR_RP = "\t\tm_pRSupp->SetRVar_rp(\"%pn\", nParam - (INCNT-REPCNT), %pi, REPCNT, &pParam[INCNT-REPCNT], NULL);\r\n";
var FP_NNSIM_SETRVARV =
    "\t\tlIndex = %pi;\r\n" +
    "\t\tSafeArrayGetElement(pParam->parray, (LONG *)&lIndex, &varElem);\r\n" +
    "\t\thr = m_pRSupp->SetRVarV(\"%pn\", &varElem, NULL);\r\n" +
    "\t\tVariantClear(&varElem);\r\n" +
    "\t\tCHECK_HR(L\"Setting of '%pn' failed.\")\r\n";
var FP_NNSIM_SETRVARSA_RP =
    "\t\thr = m_pRSupp->SetRVarSA_rp(\"%pn\", nParam, %pi, INCNT, REPCNT, %dss, pParam, NULL);\r\n" +
	"\t\tCHECK_HR(L\"Setting of '%pn' failed.\")\r\n";
var FP_AGG_SETRVAR = "\t\tm_pRSupp->SetRVar(\"%pn\", nSize, pParam, NULL);\r\n";

var FP_SIM_GETRVAR = "\t\tm_pRSupp->GetRVar(\"%pn\", 1, &lRSize, pResult, pFlag);\r\n";
var FP_NNSIM_GETRVARNN =
    "\t\thr = m_pRSupp->GetRVarNN(\"%pn\", %sl, 1, &lRSize, pResult, pFlag);\r\n" +
    "\t\tCHECK_HR(L\"Failure while fetching results.\")\r\n";
var FP_GEN_SCALAR_GETRVAR = "\t\tm_pRSupp->GetRVar(\"%pn\", 1, &lRSize, pResult, pFlag);\r\n";
var FP_GEN_VECTOR_GETRVAR = "\t\tm_pRSupp->GetRVar(\"%pn\", nSize, &lRSize, pResult, pFlag);\r\n";
var FP_NNGEN_SCALAR_GETRVARNN =
    "\t\thr = m_pRSupp->GetRVarNN(\"%pn\", %sl, 1, &lRSize, pResult, pFlag);\r\n" +
    "\t\tCHECK_HR(L\"Failure while fetching results.\")\r\n";
var FP_NNGEN_VECTOR_GETRVARNN =
    "\t\thr = m_pRSupp->GetRVarNN(\"%pn\", %sl, nSize, &lRSize, pResult, pFlag);\r\n" +
    "\t\tCHECK_HR(L\"Failure while fetching results.\")\r\n";
